$(function(){
    "use strict";
    let href = window.location.href;
    let hrefINdex = href.indexOf('=');
    if(hrefINdex>0){
        var pro_id = href.substring(hrefINdex+1);
    }

    pro_id = 32

    $.ajax({
        url:'http://jk.com/Admin/Project/projectB',
        type:'post',
        data:{
            pro_id:pro_id
        },
        success:function(data){
            // window.sessionStorage['pro_id'] = data.res.pro_id
            let datas = data.res
            let htmls = `
                <li>
                        <span class="CompanyInfo_name">项目编号：</span>
                        <span class="info_span">${datas.pro_sn}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">项目名称：</span>
                        <span class="info_span">${datas.pro_name}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">资本化、费用支出选项：</span>
                        <span class="info_span">${datas.pro_type_name}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">研发形式：</span>
                        <span class="info_span">${datas.pro_method_name}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">技术领域：</span>
                        <span class="info_span">${datas.tec_name}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">状态：</span>
                        <span class="info_span">${datas.pro_status_name}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">研发机构：</span>
                        <span class="info_span">${datas.pro_jigou}</span>
                    </li>
                    <li class="textarea_box">
                        <span class="CompanyInfo_name ver_top">主要内容：</span>
                        <p class="info_span active">${datas.pro_content}</p>
                    </li>
            `
            $('#basic_info').children('ul').html(htmls)
        }
    })
    $.ajax({
        url:'http://jk.com/Admin/Project/projectA',
        type:'post',
        data:{
            pro_id:pro_id
        },
        success:function(data){
            let datas = data.res
            let htmls = `
                <li>
                        <span class="CompanyInfo_name">申请人：</span>
                        <span class="info_span">${datas.apply_user}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">申请时间：</span>
                        <span class="info_span">${datas.apply_time}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">实施开始时间：</span>
                        <span class="info_span">${datas.pro_start}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">实施结束时间：</span>
                        <span class="info_span">${datas.pro_end}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">企业所得税优惠事项备案表：</span>
                        <span class="info_span">${datas.tax_reduce_recorder_name}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">计划任务书：</span>
                        <span class="info_span">${datas.apply_plan_name}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">立项决议书：</span>
                        <span class="info_span">${datas.resolution_book_name}</span>
                    </li>
            `
            $('#apply').children('ul').html(htmls)
        }
    })
    $.ajax({
        url:'http://jk.com/Admin/Project/projectO',
        type:'post',
        data:{
            pro_id:pro_id
        },
        success:function(data){
            let search_result = data.res.search_result
            let argu_result = data.res.argu_result
            let research_result = data.res.research_result
            if(search_result.length>0){
                let jiansuo_htmls = '<p class=" col-sm-12 lookInfo_title">检索(选)</p>'
                for(let j = 0;j < search_result.length; j++){
                    jiansuo_htmls += `
                    <ul class=" col-sm-12 CompanyInfoList">
                    <li>
                        <span class="CompanyInfo_name">检索人员：</span>
                        <span class="info_span">${search_result[j].search_user}</span>
                    </li>
                    <li class="textarea_box">
                        <span class="CompanyInfo_name ver_top">检索内容：</span>
                        <p class="info_span active">${search_result[j].search_content}</p>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">检索时间：</span>
                        <span class="info_span">${search_result[j].search_time}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">检索地点：</span>
                        <span class="info_span">${search_result[j].search_addr_province} ${search_result[j].search_addr_city} ${search_result[j].search_addr_county}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">检索凭证：</span>
                        <span class="info_span">${search_result[j].search_voucher_name}  ${search_result[j].search_voucher_size}kb</span>
                    </li>
                    </ul>
                `
                }
                $('#jiansuo').html(jiansuo_htmls)
            }else{
                $('#jiansuo').remove()
            }
            if(argu_result.length>0){
                let lunzheng_htmls = '<p class=" col-sm-12 lookInfo_title">论证(选)</p>'
                for(let l = 0;l < argu_result.length; l++){
                    lunzheng_htmls += `
                    <ul class=" col-sm-12 CompanyInfoList">
                    <li>
                        <span class="CompanyInfo_name">论证专家：</span>
                        <span class="info_span">${argu_result[l].argu_user}</span>
                    </li>
                    <li class="textarea_box">
                        <span class="CompanyInfo_name ver_top">论证内容：</span>
                        <p class="info_span active">${argu_result[l].argu_content}</p>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">立项结论：</span>
                        <span class="info_span">${argu_result[l].argu_result}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">论证时间：</span>
                        <span class="info_span">${argu_result[l].argu_time}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">论证地点：</span>
                        <span class="info_span">${argu_result[l].argu_addr_province} ${argu_result[l].argu_addr_city} ${argu_result[l].argu_addr_county}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">立项文件：</span>
                        <span class="info_span">${argu_result[l].argu_file_name} ${argu_result[l].argu_file_size}kb</span>
                    </li>
                    </ul>
                `
                }
                $('#lunzheng').html(lunzheng_htmls)
            }else{
                $('#lunzheng').remove()
            }
            if(research_result.length>0){
                let diaoyan_htmls = '<p class=" col-sm-12 lookInfo_title">项目调研(选)</p>'
                for(let d = 0;d < research_result.length; d++){
                    diaoyan_htmls += `
                    <ul class=" col-sm-12 CompanyInfoList">
                    <li>
                        <span class="CompanyInfo_name">调研人员：</span>
                        <span class="info_span">${research_result[d].research_user}</span>
                    </li>
                    <li class="textarea_box">
                        <span class="CompanyInfo_name ver_top">调研内容：</span>
                        <p class="info_span active">${research_result[d].research_content}</p>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">调研时间：</span>
                        <span class="info_span">${research_result[d].research_time}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">调研地点：</span>
                        <span class="info_span">${research_result[d].research_addr_province} ${research_result[d].research_addr_city} ${research_result[d].research_addr_county}</span>
                    </li>
                    <li>
                        <span class="CompanyInfo_name">调研报告：</span>
                        <span class="info_span">${research_result[d].research_report_name} ${research_result[d].research_report_size}kb</span>
                    </li>
                    </ul>
                `
                }
                $('#diaoyan').html(diaoyan_htmls)
            }else{
                $('#diaoyan').remove()
            }



        }
    })

    // $('#edit').click(function(e){
    //     e.preventDefault()
    //     window.location.href='lu_establishmentBasicInfo.html?pro_id=32'
    // })
})